package com.luo.contentprovider.domain.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.provider.BaseColumns;

/**
 * 
 */
public final class PersonSQLTable implements BaseColumns
{
	
	public static final String TABLE_NAME = "person";
	
	// 
	public static final String COLUMN_ID = BaseColumns._ID;
	
	/**
	 * 字段，
	 */
	public static final String COLUMN_NAME = "name";
	
	/**
	 * 年龄
	 */
	public static final String COLUMN_AGE = "age";
	
	/**
	 * 
	 */
	public static final String COLUMN_NUM = "shen_num";
	

	
	private PersonSQLTable()
	{
	}
	
	
	public static final void createTable(SQLiteDatabase db)
	{
		db.execSQL("CREATE TABLE " + PersonSQLTable.TABLE_NAME + " ("
				+ PersonSQLTable.COLUMN_ID
				+ " INTEGER NOT NULL PRIMARY KEY,"
				+ PersonSQLTable.COLUMN_NAME + " TEXT NOT NULL,"
				+ PersonSQLTable.COLUMN_AGE + " INTEGER NOT NULL,"
				+ PersonSQLTable.COLUMN_NUM + " TEXT NOT NULL);");
		
	    // 创建索引
		
		
	}
	
	public static final void dropTable(SQLiteDatabase db)
	{
		db.execSQL("DROP TABLE IF EXISTS " + PersonSQLTable.TABLE_NAME);
//		db.execSQL("DROP INDEX IF EXISTS " + ReciteSQLTable.SEARCH_INDEX);
	}
	
	/**
	 * 初始数据
	 * 
	 *@param db
	 *@param context
	 *@deprecated
	 *
	 */
	public static final void initTable(SQLiteDatabase db, Context context)
	{
		// 插入初始数据到area表中
//		InputStreamReader in = new InputStreamReader(context.getResources()
//				.openRawResource(R.raw.area));
//		BufferedReader reader = new BufferedReader(in);
//		String line;
//		try
//		{
//			line = reader.readLine();
//			while (null != line && !"".equals(line.trim()))
//			{
//				db.execSQL(line);
//				line = reader.readLine();
//			}
//			reader.close();
//		}
//		catch (IOException e)
//		{
//			e.printStackTrace();
//		}
	}
}